<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.10.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Direct3D 12 Memory Allocator: D3D12MA::Allocator Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">Direct3D 12 Memory Allocator
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.10.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespace_d3_d12_m_a.html">D3D12MA</a></li><li class="navelem"><a class="el" href="class_d3_d12_m_a_1_1_allocator.html">Allocator</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_d3_d12_m_a_1_1_allocator-members.html">List of all members</a>  </div>
  <div class="headertitle"><div class="title">D3D12MA::Allocator Class Reference</div></div>
</div><!--header-->
<div class="contents">

<p>Represents main object of this library initialized for particular <code>ID3D12Device</code>.  
 <a href="#details">More...</a></p>

<p><code>#include &lt;D3D12MemAlloc.h&gt;</code></p>
<div class="dynheader">
Inheritance diagram for D3D12MA::Allocator:</div>
<div class="dyncontent">
 <div class="center">
  <img src="class_d3_d12_m_a_1_1_allocator.png" alt=""/>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ae276d2358a58a36f8c6639f837f29be5" id="r_ae276d2358a58a36f8c6639f837f29be5"><td class="memItemLeft" align="right" valign="top">const D3D12_FEATURE_DATA_D3D12_OPTIONS &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ae276d2358a58a36f8c6639f837f29be5">GetD3D12Options</a> () const</td></tr>
<tr class="memdesc:ae276d2358a58a36f8c6639f837f29be5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns cached options retrieved from D3D12 device.  <br /></td></tr>
<tr class="separator:ae276d2358a58a36f8c6639f837f29be5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9e742884bd45dd7f01193d13fcd05af0" id="r_a9e742884bd45dd7f01193d13fcd05af0"><td class="memItemLeft" align="right" valign="top">BOOL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a9e742884bd45dd7f01193d13fcd05af0">IsUMA</a> () const</td></tr>
<tr class="memdesc:a9e742884bd45dd7f01193d13fcd05af0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns true if <code>D3D12_FEATURE_DATA_ARCHITECTURE1::UMA</code> was found to be true.  <br /></td></tr>
<tr class="separator:a9e742884bd45dd7f01193d13fcd05af0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a08210561b92c4bd7ede9dd7beba4bb80" id="r_a08210561b92c4bd7ede9dd7beba4bb80"><td class="memItemLeft" align="right" valign="top">BOOL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a08210561b92c4bd7ede9dd7beba4bb80">IsCacheCoherentUMA</a> () const</td></tr>
<tr class="memdesc:a08210561b92c4bd7ede9dd7beba4bb80"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns true if <code>D3D12_FEATURE_DATA_ARCHITECTURE1::CacheCoherentUMA</code> was found to be true.  <br /></td></tr>
<tr class="separator:a08210561b92c4bd7ede9dd7beba4bb80"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3f3fd1e88cf2cd02257fe272e08a273c" id="r_a3f3fd1e88cf2cd02257fe272e08a273c"><td class="memItemLeft" align="right" valign="top">BOOL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a3f3fd1e88cf2cd02257fe272e08a273c">IsGPUUploadHeapSupported</a> () const</td></tr>
<tr class="memdesc:a3f3fd1e88cf2cd02257fe272e08a273c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns true if GPU Upload Heaps are supported on the current system.  <br /></td></tr>
<tr class="separator:a3f3fd1e88cf2cd02257fe272e08a273c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a434ae3147209953253da26687bfd62dc" id="r_a434ae3147209953253da26687bfd62dc"><td class="memItemLeft" align="right" valign="top">UINT64&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a434ae3147209953253da26687bfd62dc">GetMemoryCapacity</a> (UINT memorySegmentGroup) const</td></tr>
<tr class="memdesc:a434ae3147209953253da26687bfd62dc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns total amount of memory of specific segment group, in bytes.  <br /></td></tr>
<tr class="separator:a434ae3147209953253da26687bfd62dc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa37d6b9fe8ea0864f7a35b9d68e8345a" id="r_aa37d6b9fe8ea0864f7a35b9d68e8345a"><td class="memItemLeft" align="right" valign="top">HRESULT&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aa37d6b9fe8ea0864f7a35b9d68e8345a">CreateResource</a> (const <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">ALLOCATION_DESC</a> *pAllocDesc, const D3D12_RESOURCE_DESC *pResourceDesc, D3D12_RESOURCE_STATES InitialResourceState, const D3D12_CLEAR_VALUE *pOptimizedClearValue, <a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> **ppAllocation, REFIID riidResource, void **ppvResource)</td></tr>
<tr class="memdesc:aa37d6b9fe8ea0864f7a35b9d68e8345a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation function.  <br /></td></tr>
<tr class="separator:aa37d6b9fe8ea0864f7a35b9d68e8345a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7a1c79c79a7a573c438aa45c4a531b96" id="r_a7a1c79c79a7a573c438aa45c4a531b96"><td class="memItemLeft" align="right" valign="top">HRESULT&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a7a1c79c79a7a573c438aa45c4a531b96">CreateResource2</a> (const <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">ALLOCATION_DESC</a> *pAllocDesc, const D3D12_RESOURCE_DESC1 *pResourceDesc, D3D12_RESOURCE_STATES InitialResourceState, const D3D12_CLEAR_VALUE *pOptimizedClearValue, <a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> **ppAllocation, REFIID riidResource, void **ppvResource)</td></tr>
<tr class="memdesc:a7a1c79c79a7a573c438aa45c4a531b96"><td class="mdescLeft">&#160;</td><td class="mdescRight">Similar to <a class="el" href="#aa37d6b9fe8ea0864f7a35b9d68e8345a" title="Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation functi...">Allocator::CreateResource</a>, but supports new structure <code>D3D12_RESOURCE_DESC1</code>.  <br /></td></tr>
<tr class="separator:a7a1c79c79a7a573c438aa45c4a531b96"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a323b2af320b01d0fdecfc515c75db747" id="r_a323b2af320b01d0fdecfc515c75db747"><td class="memItemLeft" align="right" valign="top">HRESULT&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a323b2af320b01d0fdecfc515c75db747">CreateResource3</a> (const <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">ALLOCATION_DESC</a> *pAllocDesc, const D3D12_RESOURCE_DESC1 *pResourceDesc, D3D12_BARRIER_LAYOUT InitialLayout, const D3D12_CLEAR_VALUE *pOptimizedClearValue, UINT32 NumCastableFormats, DXGI_FORMAT *pCastableFormats, <a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> **ppAllocation, REFIID riidResource, void **ppvResource)</td></tr>
<tr class="memdesc:a323b2af320b01d0fdecfc515c75db747"><td class="mdescLeft">&#160;</td><td class="mdescRight">Similar to <a class="el" href="#a7a1c79c79a7a573c438aa45c4a531b96" title="Similar to Allocator::CreateResource, but supports new structure D3D12_RESOURCE_DESC1.">Allocator::CreateResource2</a>, but there are initial layout instead of state and castable formats list.  <br /></td></tr>
<tr class="separator:a323b2af320b01d0fdecfc515c75db747"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acb8a10a5ea30171ce60128286aec5ee2" id="r_acb8a10a5ea30171ce60128286aec5ee2"><td class="memItemLeft" align="right" valign="top">HRESULT&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#acb8a10a5ea30171ce60128286aec5ee2">AllocateMemory</a> (const <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">ALLOCATION_DESC</a> *pAllocDesc, const D3D12_RESOURCE_ALLOCATION_INFO *pAllocInfo, <a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> **ppAllocation)</td></tr>
<tr class="memdesc:acb8a10a5ea30171ce60128286aec5ee2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocates memory without creating any resource placed in it.  <br /></td></tr>
<tr class="separator:acb8a10a5ea30171ce60128286aec5ee2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab45536f92410aedb7be44ea36b1b4717" id="r_ab45536f92410aedb7be44ea36b1b4717"><td class="memItemLeft" align="right" valign="top">HRESULT&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ab45536f92410aedb7be44ea36b1b4717">CreateAliasingResource</a> (<a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> *pAllocation, UINT64 AllocationLocalOffset, const D3D12_RESOURCE_DESC *pResourceDesc, D3D12_RESOURCE_STATES InitialResourceState, const D3D12_CLEAR_VALUE *pOptimizedClearValue, REFIID riidResource, void **ppvResource)</td></tr>
<tr class="memdesc:ab45536f92410aedb7be44ea36b1b4717"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new resource in place of an existing allocation. This is useful for memory aliasing.  <br /></td></tr>
<tr class="separator:ab45536f92410aedb7be44ea36b1b4717"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad3b83cc5707cb4ed92bc277069c4ddd6" id="r_ad3b83cc5707cb4ed92bc277069c4ddd6"><td class="memItemLeft" align="right" valign="top">HRESULT&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ad3b83cc5707cb4ed92bc277069c4ddd6">CreateAliasingResource1</a> (<a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> *pAllocation, UINT64 AllocationLocalOffset, const D3D12_RESOURCE_DESC1 *pResourceDesc, D3D12_RESOURCE_STATES InitialResourceState, const D3D12_CLEAR_VALUE *pOptimizedClearValue, REFIID riidResource, void **ppvResource)</td></tr>
<tr class="memdesc:ad3b83cc5707cb4ed92bc277069c4ddd6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Similar to <a class="el" href="#ab45536f92410aedb7be44ea36b1b4717" title="Creates a new resource in place of an existing allocation. This is useful for memory aliasing.">Allocator::CreateAliasingResource</a>, but supports new structure <code>D3D12_RESOURCE_DESC1</code>.  <br /></td></tr>
<tr class="separator:ad3b83cc5707cb4ed92bc277069c4ddd6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a562cbaa71cbd333cade09cd67ed82453" id="r_a562cbaa71cbd333cade09cd67ed82453"><td class="memItemLeft" align="right" valign="top">HRESULT&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a562cbaa71cbd333cade09cd67ed82453">CreateAliasingResource2</a> (<a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> *pAllocation, UINT64 AllocationLocalOffset, const D3D12_RESOURCE_DESC1 *pResourceDesc, D3D12_BARRIER_LAYOUT InitialLayout, const D3D12_CLEAR_VALUE *pOptimizedClearValue, UINT32 NumCastableFormats, DXGI_FORMAT *pCastableFormats, REFIID riidResource, void **ppvResource)</td></tr>
<tr class="memdesc:a562cbaa71cbd333cade09cd67ed82453"><td class="mdescLeft">&#160;</td><td class="mdescRight">Similar to <a class="el" href="#ad3b83cc5707cb4ed92bc277069c4ddd6" title="Similar to Allocator::CreateAliasingResource, but supports new structure D3D12_RESOURCE_DESC1.">Allocator::CreateAliasingResource1</a>, but there are initial layout instead of state and castable formats list.  <br /></td></tr>
<tr class="separator:a562cbaa71cbd333cade09cd67ed82453"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aac7b1f6bf53cbf4c4ce2264cb72ca515" id="r_aac7b1f6bf53cbf4c4ce2264cb72ca515"><td class="memItemLeft" align="right" valign="top">HRESULT&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aac7b1f6bf53cbf4c4ce2264cb72ca515">CreatePool</a> (const <a class="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html">POOL_DESC</a> *pPoolDesc, <a class="el" href="class_d3_d12_m_a_1_1_pool.html">Pool</a> **ppPool)</td></tr>
<tr class="memdesc:aac7b1f6bf53cbf4c4ce2264cb72ca515"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates custom pool.  <br /></td></tr>
<tr class="separator:aac7b1f6bf53cbf4c4ce2264cb72ca515"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a468ba0c93121eaaee402b08775f1dd11" id="r_a468ba0c93121eaaee402b08775f1dd11"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a468ba0c93121eaaee402b08775f1dd11">SetCurrentFrameIndex</a> (UINT frameIndex)</td></tr>
<tr class="memdesc:a468ba0c93121eaaee402b08775f1dd11"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the index of the current frame.  <br /></td></tr>
<tr class="separator:a468ba0c93121eaaee402b08775f1dd11"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1ac113daec5f6ef28ecb1786cf544144" id="r_a1ac113daec5f6ef28ecb1786cf544144"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a1ac113daec5f6ef28ecb1786cf544144">GetBudget</a> (<a class="el" href="struct_d3_d12_m_a_1_1_budget.html">Budget</a> *pLocalBudget, <a class="el" href="struct_d3_d12_m_a_1_1_budget.html">Budget</a> *pNonLocalBudget)</td></tr>
<tr class="memdesc:a1ac113daec5f6ef28ecb1786cf544144"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieves information about current memory usage and budget.  <br /></td></tr>
<tr class="separator:a1ac113daec5f6ef28ecb1786cf544144"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a99db00df909963573a976c203b107d22" id="r_a99db00df909963573a976c203b107d22"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a99db00df909963573a976c203b107d22">CalculateStatistics</a> (<a class="el" href="struct_d3_d12_m_a_1_1_total_statistics.html">TotalStatistics</a> *pStats)</td></tr>
<tr class="memdesc:a99db00df909963573a976c203b107d22"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieves statistics from current state of the allocator.  <br /></td></tr>
<tr class="separator:a99db00df909963573a976c203b107d22"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a29716b3084916abed7793bf2ec4b65db" id="r_a29716b3084916abed7793bf2ec4b65db"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a29716b3084916abed7793bf2ec4b65db">BuildStatsString</a> (WCHAR **ppStatsString, BOOL DetailedMap) const</td></tr>
<tr class="memdesc:a29716b3084916abed7793bf2ec4b65db"><td class="mdescLeft">&#160;</td><td class="mdescRight">Builds and returns statistics as a string in JSON format.  <br /></td></tr>
<tr class="separator:a29716b3084916abed7793bf2ec4b65db"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8392663494384c16d8bfa12b827b4f9c" id="r_a8392663494384c16d8bfa12b827b4f9c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a8392663494384c16d8bfa12b827b4f9c">FreeStatsString</a> (WCHAR *pStatsString) const</td></tr>
<tr class="memdesc:a8392663494384c16d8bfa12b827b4f9c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Frees memory of a string returned from <a class="el" href="#a29716b3084916abed7793bf2ec4b65db" title="Builds and returns statistics as a string in JSON format.">Allocator::BuildStatsString</a>.  <br /></td></tr>
<tr class="separator:a8392663494384c16d8bfa12b827b4f9c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a08e1468f1dbb63ce3bf6680e592b2143" id="r_a08e1468f1dbb63ce3bf6680e592b2143"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a08e1468f1dbb63ce3bf6680e592b2143">BeginDefragmentation</a> (const <a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c.html">DEFRAGMENTATION_DESC</a> *pDesc, <a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html">DefragmentationContext</a> **ppContext)</td></tr>
<tr class="memdesc:a08e1468f1dbb63ce3bf6680e592b2143"><td class="mdescLeft">&#160;</td><td class="mdescRight">Begins defragmentation process of the default pools.  <br /></td></tr>
<tr class="separator:a08e1468f1dbb63ce3bf6680e592b2143"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Represents main object of this library initialized for particular <code>ID3D12Device</code>. </p>
<p>Fill structure <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_o_r___d_e_s_c.html" title="Parameters of created Allocator object. To be used with CreateAllocator().">D3D12MA::ALLOCATOR_DESC</a> and call function <a class="el" href="#a458f044fdc81e4a0b147e99ffcf73459" title="Creates new main D3D12MA::Allocator object and returns it through ppAllocator.">CreateAllocator()</a> to create it. Call method <code>Release()</code> to destroy it.</p>
<p>It is recommended to create just one object of this type per <code>ID3D12Device</code> object, right after Direct3D 12 is initialized and keep it alive until before Direct3D device is destroyed. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="acb8a10a5ea30171ce60128286aec5ee2" name="acb8a10a5ea30171ce60128286aec5ee2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acb8a10a5ea30171ce60128286aec5ee2">&#9670;&#160;</a></span>AllocateMemory()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">HRESULT D3D12MA::Allocator::AllocateMemory </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">ALLOCATION_DESC</a> *</td>          <td class="paramname"><span class="paramname"><em>pAllocDesc</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const D3D12_RESOURCE_ALLOCATION_INFO *</td>          <td class="paramname"><span class="paramname"><em>pAllocInfo</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> **</td>          <td class="paramname"><span class="paramname"><em>ppAllocation</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Allocates memory without creating any resource placed in it. </p>
<p>This function is similar to <code>ID3D12Device::CreateHeap</code>, but it may really assign part of a larger, existing heap to the allocation.</p>
<p><code>pAllocDesc-&gt;heapFlags</code> should contain one of these values, depending on type of resources you are going to create in this memory: <code>D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS</code>, <code>D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES</code>, <code>D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES</code>. Except if you validate that ResourceHeapTier = 2 - then <code>heapFlags</code> may be <code>D3D12_HEAP_FLAG_ALLOW_ALL_BUFFERS_AND_TEXTURES</code> = 0. Additional flags in <code>heapFlags</code> are allowed as well.</p>
<p><code>pAllocInfo-&gt;SizeInBytes</code> must be multiply of 64KB. <code>pAllocInfo-&gt;Alignment</code> must be one of the legal values as described in documentation of <code>D3D12_HEAP_DESC</code>.</p>
<p>If you use <a class="el" href="namespace_d3_d12_m_a.html#abbad31a7e0b3d09d77f3fb704b77645ea661a5472dba3dcecc5a2cc92afd25675">D3D12MA::ALLOCATION_FLAG_COMMITTED</a> you will get a separate memory block - a heap that always has offset 0. </p>

</div>
</div>
<a id="a08e1468f1dbb63ce3bf6680e592b2143" name="a08e1468f1dbb63ce3bf6680e592b2143"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a08e1468f1dbb63ce3bf6680e592b2143">&#9670;&#160;</a></span>BeginDefragmentation()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void D3D12MA::Allocator::BeginDefragmentation </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="struct_d3_d12_m_a_1_1_d_e_f_r_a_g_m_e_n_t_a_t_i_o_n___d_e_s_c.html">DEFRAGMENTATION_DESC</a> *</td>          <td class="paramname"><span class="paramname"><em>pDesc</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_defragmentation_context.html">DefragmentationContext</a> **</td>          <td class="paramname"><span class="paramname"><em>ppContext</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Begins defragmentation process of the default pools. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir"></td><td class="paramname">pDesc</td><td>Structure filled with parameters of defragmentation. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">ppContext</td><td>Context object that will manage defragmentation.</td></tr>
  </table>
  </dd>
</dl>
<p>For more information about defragmentation, see documentation chapter: <a class="el" href="defragmentation.html">Defragmentation</a>. </p>

</div>
</div>
<a id="a29716b3084916abed7793bf2ec4b65db" name="a29716b3084916abed7793bf2ec4b65db"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a29716b3084916abed7793bf2ec4b65db">&#9670;&#160;</a></span>BuildStatsString()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void D3D12MA::Allocator::BuildStatsString </td>
          <td>(</td>
          <td class="paramtype">WCHAR **</td>          <td class="paramname"><span class="paramname"><em>ppStatsString</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">BOOL</td>          <td class="paramname"><span class="paramname"><em>DetailedMap</em></span>&#160;) const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Builds and returns statistics as a string in JSON format. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">ppStatsString</td><td>Must be freed using <a class="el" href="#a8392663494384c16d8bfa12b827b4f9c" title="Frees memory of a string returned from Allocator::BuildStatsString.">Allocator::FreeStatsString</a>. </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">DetailedMap</td><td><code>TRUE</code> to include full list of allocations (can make the string quite long), <code>FALSE</code> to only return statistics. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a99db00df909963573a976c203b107d22" name="a99db00df909963573a976c203b107d22"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a99db00df909963573a976c203b107d22">&#9670;&#160;</a></span>CalculateStatistics()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void D3D12MA::Allocator::CalculateStatistics </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_total_statistics.html">TotalStatistics</a> *</td>          <td class="paramname"><span class="paramname"><em>pStats</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Retrieves statistics from current state of the allocator. </p>
<p>This function is called "calculate" not "get" because it has to traverse all internal data structures, so it may be quite slow. Use it for debugging purposes. For faster but more brief statistics suitable to be called every frame or every allocation, use <a class="el" href="#a1ac113daec5f6ef28ecb1786cf544144" title="Retrieves information about current memory usage and budget.">GetBudget()</a>.</p>
<p>Note that when using allocator from multiple threads, returned information may immediately become outdated. </p>

</div>
</div>
<a id="ab45536f92410aedb7be44ea36b1b4717" name="ab45536f92410aedb7be44ea36b1b4717"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab45536f92410aedb7be44ea36b1b4717">&#9670;&#160;</a></span>CreateAliasingResource()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">HRESULT D3D12MA::Allocator::CreateAliasingResource </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> *</td>          <td class="paramname"><span class="paramname"><em>pAllocation</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">UINT64</td>          <td class="paramname"><span class="paramname"><em>AllocationLocalOffset</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const D3D12_RESOURCE_DESC *</td>          <td class="paramname"><span class="paramname"><em>pResourceDesc</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">D3D12_RESOURCE_STATES</td>          <td class="paramname"><span class="paramname"><em>InitialResourceState</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const D3D12_CLEAR_VALUE *</td>          <td class="paramname"><span class="paramname"><em>pOptimizedClearValue</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">REFIID</td>          <td class="paramname"><span class="paramname"><em>riidResource</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void **</td>          <td class="paramname"><span class="paramname"><em>ppvResource</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Creates a new resource in place of an existing allocation. This is useful for memory aliasing. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir"></td><td class="paramname">pAllocation</td><td>Existing allocation indicating the memory where the new resource should be created. It can be created using <a class="el" href="#aa37d6b9fe8ea0864f7a35b9d68e8345a" title="Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation functi...">D3D12MA::Allocator::CreateResource</a> and already have a resource bound to it, or can be a raw memory allocated with <a class="el" href="#acb8a10a5ea30171ce60128286aec5ee2" title="Allocates memory without creating any resource placed in it.">D3D12MA::Allocator::AllocateMemory</a>. It must not be created as committed so that <code>ID3D12Heap</code> is available and not implicit. </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">AllocationLocalOffset</td><td>Additional offset in bytes to be applied when allocating the resource. Local from the start of <code>pAllocation</code>, not the beginning of the whole <code>ID3D12Heap</code>! If the new resource should start from the beginning of the <code>pAllocation</code> it should be 0. </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">pResourceDesc</td><td>Description of the new resource to be created. </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">InitialResourceState</td><td></td></tr>
    <tr><td class="paramdir"></td><td class="paramname">pOptimizedClearValue</td><td></td></tr>
    <tr><td class="paramdir"></td><td class="paramname">riidResource</td><td></td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">ppvResource</td><td>Returns pointer to the new resource. The resource is not bound with <code>pAllocation</code>. This pointer must not be null - you must get the resource pointer and <code>Release</code> it when no longer needed.</td></tr>
  </table>
  </dd>
</dl>
<p>Memory requirements of the new resource are checked for validation. If its size exceeds the end of <code>pAllocation</code> or required alignment is not fulfilled considering <code>pAllocation-&gt;GetOffset() + AllocationLocalOffset</code>, the function returns <code>E_INVALIDARG</code>. </p>

</div>
</div>
<a id="ad3b83cc5707cb4ed92bc277069c4ddd6" name="ad3b83cc5707cb4ed92bc277069c4ddd6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad3b83cc5707cb4ed92bc277069c4ddd6">&#9670;&#160;</a></span>CreateAliasingResource1()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">HRESULT D3D12MA::Allocator::CreateAliasingResource1 </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> *</td>          <td class="paramname"><span class="paramname"><em>pAllocation</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">UINT64</td>          <td class="paramname"><span class="paramname"><em>AllocationLocalOffset</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const D3D12_RESOURCE_DESC1 *</td>          <td class="paramname"><span class="paramname"><em>pResourceDesc</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">D3D12_RESOURCE_STATES</td>          <td class="paramname"><span class="paramname"><em>InitialResourceState</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const D3D12_CLEAR_VALUE *</td>          <td class="paramname"><span class="paramname"><em>pOptimizedClearValue</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">REFIID</td>          <td class="paramname"><span class="paramname"><em>riidResource</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void **</td>          <td class="paramname"><span class="paramname"><em>ppvResource</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Similar to <a class="el" href="#ab45536f92410aedb7be44ea36b1b4717" title="Creates a new resource in place of an existing allocation. This is useful for memory aliasing.">Allocator::CreateAliasingResource</a>, but supports new structure <code>D3D12_RESOURCE_DESC1</code>. </p>
<p>It internally uses <code>ID3D12Device8::CreatePlacedResource1</code>.</p>
<p>To work correctly, <code>ID3D12Device8</code> interface must be available in the current system. Otherwise, <code>E_NOINTERFACE</code> is returned. </p>

</div>
</div>
<a id="a562cbaa71cbd333cade09cd67ed82453" name="a562cbaa71cbd333cade09cd67ed82453"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a562cbaa71cbd333cade09cd67ed82453">&#9670;&#160;</a></span>CreateAliasingResource2()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">HRESULT D3D12MA::Allocator::CreateAliasingResource2 </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> *</td>          <td class="paramname"><span class="paramname"><em>pAllocation</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">UINT64</td>          <td class="paramname"><span class="paramname"><em>AllocationLocalOffset</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const D3D12_RESOURCE_DESC1 *</td>          <td class="paramname"><span class="paramname"><em>pResourceDesc</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">D3D12_BARRIER_LAYOUT</td>          <td class="paramname"><span class="paramname"><em>InitialLayout</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const D3D12_CLEAR_VALUE *</td>          <td class="paramname"><span class="paramname"><em>pOptimizedClearValue</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">UINT32</td>          <td class="paramname"><span class="paramname"><em>NumCastableFormats</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DXGI_FORMAT *</td>          <td class="paramname"><span class="paramname"><em>pCastableFormats</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">REFIID</td>          <td class="paramname"><span class="paramname"><em>riidResource</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void **</td>          <td class="paramname"><span class="paramname"><em>ppvResource</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Similar to <a class="el" href="#ad3b83cc5707cb4ed92bc277069c4ddd6" title="Similar to Allocator::CreateAliasingResource, but supports new structure D3D12_RESOURCE_DESC1.">Allocator::CreateAliasingResource1</a>, but there are initial layout instead of state and castable formats list. </p>
<p>It internally uses <code>ID3D12Device10::CreatePlacedResource2</code>.</p>
<p>To work correctly, <code>ID3D12Device10</code> interface must be available in the current system. Otherwise, <code>E_NOINTERFACE</code> is returned. </p>

</div>
</div>
<a id="aac7b1f6bf53cbf4c4ce2264cb72ca515" name="aac7b1f6bf53cbf4c4ce2264cb72ca515"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aac7b1f6bf53cbf4c4ce2264cb72ca515">&#9670;&#160;</a></span>CreatePool()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">HRESULT D3D12MA::Allocator::CreatePool </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="struct_d3_d12_m_a_1_1_p_o_o_l___d_e_s_c.html">POOL_DESC</a> *</td>          <td class="paramname"><span class="paramname"><em>pPoolDesc</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_pool.html">Pool</a> **</td>          <td class="paramname"><span class="paramname"><em>ppPool</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Creates custom pool. </p>

</div>
</div>
<a id="aa37d6b9fe8ea0864f7a35b9d68e8345a" name="aa37d6b9fe8ea0864f7a35b9d68e8345a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa37d6b9fe8ea0864f7a35b9d68e8345a">&#9670;&#160;</a></span>CreateResource()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">HRESULT D3D12MA::Allocator::CreateResource </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">ALLOCATION_DESC</a> *</td>          <td class="paramname"><span class="paramname"><em>pAllocDesc</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const D3D12_RESOURCE_DESC *</td>          <td class="paramname"><span class="paramname"><em>pResourceDesc</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">D3D12_RESOURCE_STATES</td>          <td class="paramname"><span class="paramname"><em>InitialResourceState</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const D3D12_CLEAR_VALUE *</td>          <td class="paramname"><span class="paramname"><em>pOptimizedClearValue</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> **</td>          <td class="paramname"><span class="paramname"><em>ppAllocation</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">REFIID</td>          <td class="paramname"><span class="paramname"><em>riidResource</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void **</td>          <td class="paramname"><span class="paramname"><em>ppvResource</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation function. </p>
<p>The function is similar to <code>ID3D12Device::CreateCommittedResource</code>, but it may really call <code>ID3D12Device::CreatePlacedResource</code> to assign part of a larger, existing memory heap to the new resource, which is the main purpose of this whole library.</p>
<p>If <code>ppvResource</code> is null, you receive only <code>ppAllocation</code> object from this function. It holds pointer to <code>ID3D12Resource</code> that can be queried using function <a class="el" href="class_d3_d12_m_a_1_1_allocation.html#ad00308118252f82d8f803c623c67bf18" title="Returns D3D12 resource associated with this object.">D3D12MA::Allocation::GetResource()</a>. Reference count of the resource object is 1. It is automatically destroyed when you destroy the allocation object.</p>
<p>If <code>ppvResource</code> is not null, you receive pointer to the resource next to allocation object. Reference count of the resource object is then increased by calling <code>QueryInterface</code>, so you need to manually <code>Release</code> it along with the allocation.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir"></td><td class="paramname">pAllocDesc</td><td>Parameters of the allocation. </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">pResourceDesc</td><td>Description of created resource. </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">InitialResourceState</td><td>Initial resource state. </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">pOptimizedClearValue</td><td>Optional. Either null or optimized clear value. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">ppAllocation</td><td>Filled with pointer to new allocation object created. </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">riidResource</td><td>IID of a resource to be returned via <code>ppvResource</code>. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">ppvResource</td><td>Optional. If not null, filled with pointer to new resouce created.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>This function creates a new resource. Sub-allocation of parts of one large buffer, although recommended as a good practice, is out of scope of this library and could be implemented by the user as a higher-level logic on top of it, e.g. using the <a class="el" href="virtual_allocator.html">Virtual allocator</a> feature. </dd></dl>

</div>
</div>
<a id="a7a1c79c79a7a573c438aa45c4a531b96" name="a7a1c79c79a7a573c438aa45c4a531b96"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7a1c79c79a7a573c438aa45c4a531b96">&#9670;&#160;</a></span>CreateResource2()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">HRESULT D3D12MA::Allocator::CreateResource2 </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">ALLOCATION_DESC</a> *</td>          <td class="paramname"><span class="paramname"><em>pAllocDesc</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const D3D12_RESOURCE_DESC1 *</td>          <td class="paramname"><span class="paramname"><em>pResourceDesc</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">D3D12_RESOURCE_STATES</td>          <td class="paramname"><span class="paramname"><em>InitialResourceState</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const D3D12_CLEAR_VALUE *</td>          <td class="paramname"><span class="paramname"><em>pOptimizedClearValue</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> **</td>          <td class="paramname"><span class="paramname"><em>ppAllocation</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">REFIID</td>          <td class="paramname"><span class="paramname"><em>riidResource</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void **</td>          <td class="paramname"><span class="paramname"><em>ppvResource</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Similar to <a class="el" href="#aa37d6b9fe8ea0864f7a35b9d68e8345a" title="Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation functi...">Allocator::CreateResource</a>, but supports new structure <code>D3D12_RESOURCE_DESC1</code>. </p>
<p>It internally uses <code>ID3D12Device8::CreateCommittedResource2</code> or <code>ID3D12Device8::CreatePlacedResource1</code>.</p>
<p>To work correctly, <code>ID3D12Device8</code> interface must be available in the current system. Otherwise, <code>E_NOINTERFACE</code> is returned. </p>

</div>
</div>
<a id="a323b2af320b01d0fdecfc515c75db747" name="a323b2af320b01d0fdecfc515c75db747"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a323b2af320b01d0fdecfc515c75db747">&#9670;&#160;</a></span>CreateResource3()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">HRESULT D3D12MA::Allocator::CreateResource3 </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="struct_d3_d12_m_a_1_1_a_l_l_o_c_a_t_i_o_n___d_e_s_c.html">ALLOCATION_DESC</a> *</td>          <td class="paramname"><span class="paramname"><em>pAllocDesc</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const D3D12_RESOURCE_DESC1 *</td>          <td class="paramname"><span class="paramname"><em>pResourceDesc</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">D3D12_BARRIER_LAYOUT</td>          <td class="paramname"><span class="paramname"><em>InitialLayout</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const D3D12_CLEAR_VALUE *</td>          <td class="paramname"><span class="paramname"><em>pOptimizedClearValue</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">UINT32</td>          <td class="paramname"><span class="paramname"><em>NumCastableFormats</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DXGI_FORMAT *</td>          <td class="paramname"><span class="paramname"><em>pCastableFormats</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="class_d3_d12_m_a_1_1_allocation.html">Allocation</a> **</td>          <td class="paramname"><span class="paramname"><em>ppAllocation</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">REFIID</td>          <td class="paramname"><span class="paramname"><em>riidResource</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void **</td>          <td class="paramname"><span class="paramname"><em>ppvResource</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Similar to <a class="el" href="#a7a1c79c79a7a573c438aa45c4a531b96" title="Similar to Allocator::CreateResource, but supports new structure D3D12_RESOURCE_DESC1.">Allocator::CreateResource2</a>, but there are initial layout instead of state and castable formats list. </p>
<p>It internally uses <code>ID3D12Device10::CreateCommittedResource3</code> or <code>ID3D12Device10::CreatePlacedResource2</code>.</p>
<p>To work correctly, <code>ID3D12Device10</code> interface must be available in the current system. Otherwise, <code>E_NOINTERFACE</code> is returned. </p>

</div>
</div>
<a id="a8392663494384c16d8bfa12b827b4f9c" name="a8392663494384c16d8bfa12b827b4f9c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8392663494384c16d8bfa12b827b4f9c">&#9670;&#160;</a></span>FreeStatsString()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void D3D12MA::Allocator::FreeStatsString </td>
          <td>(</td>
          <td class="paramtype">WCHAR *</td>          <td class="paramname"><span class="paramname"><em>pStatsString</em></span></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Frees memory of a string returned from <a class="el" href="#a29716b3084916abed7793bf2ec4b65db" title="Builds and returns statistics as a string in JSON format.">Allocator::BuildStatsString</a>. </p>

</div>
</div>
<a id="a1ac113daec5f6ef28ecb1786cf544144" name="a1ac113daec5f6ef28ecb1786cf544144"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1ac113daec5f6ef28ecb1786cf544144">&#9670;&#160;</a></span>GetBudget()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void D3D12MA::Allocator::GetBudget </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_budget.html">Budget</a> *</td>          <td class="paramname"><span class="paramname"><em>pLocalBudget</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="struct_d3_d12_m_a_1_1_budget.html">Budget</a> *</td>          <td class="paramname"><span class="paramname"><em>pNonLocalBudget</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Retrieves information about current memory usage and budget. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">pLocalBudget</td><td>Optional, can be null. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">pNonLocalBudget</td><td>Optional, can be null.</td></tr>
  </table>
  </dd>
</dl>
<ul>
<li>When <a class="el" href="#a9e742884bd45dd7f01193d13fcd05af0" title="Returns true if D3D12_FEATURE_DATA_ARCHITECTURE1::UMA was found to be true.">IsUMA()</a> <code>== FALSE</code> (discrete graphics card):<ul>
<li><code>pLocalBudget</code> returns the budget of the video memory.</li>
<li><code>pNonLocalBudget</code> returns the budget of the system memory available for D3D12 resources.</li>
</ul>
</li>
<li>When <a class="el" href="#a9e742884bd45dd7f01193d13fcd05af0" title="Returns true if D3D12_FEATURE_DATA_ARCHITECTURE1::UMA was found to be true.">IsUMA()</a> <code>== TRUE</code> (integrated graphics chip):<ul>
<li><code>pLocalBudget</code> returns the budget of the shared memory available for all D3D12 resources. All memory is considered "local".</li>
<li><code>pNonLocalBudget</code> is not applicable and returns zeros.</li>
</ul>
</li>
</ul>
<p>This function is called "get" not "calculate" because it is very fast, suitable to be called every frame or every allocation. For more detailed statistics use <a class="el" href="#a99db00df909963573a976c203b107d22" title="Retrieves statistics from current state of the allocator.">CalculateStatistics()</a>.</p>
<p>Note that when using allocator from multiple threads, returned information may immediately become outdated. </p>

</div>
</div>
<a id="ae276d2358a58a36f8c6639f837f29be5" name="ae276d2358a58a36f8c6639f837f29be5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae276d2358a58a36f8c6639f837f29be5">&#9670;&#160;</a></span>GetD3D12Options()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const D3D12_FEATURE_DATA_D3D12_OPTIONS &amp; D3D12MA::Allocator::GetD3D12Options </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"></span></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns cached options retrieved from D3D12 device. </p>

</div>
</div>
<a id="a434ae3147209953253da26687bfd62dc" name="a434ae3147209953253da26687bfd62dc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a434ae3147209953253da26687bfd62dc">&#9670;&#160;</a></span>GetMemoryCapacity()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">UINT64 D3D12MA::Allocator::GetMemoryCapacity </td>
          <td>(</td>
          <td class="paramtype">UINT</td>          <td class="paramname"><span class="paramname"><em>memorySegmentGroup</em></span></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns total amount of memory of specific segment group, in bytes. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">memorySegmentGroup</td><td>use <code>DXGI_MEMORY_SEGMENT_GROUP_LOCAL</code> or DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL`.</td></tr>
  </table>
  </dd>
</dl>
<p>This information is taken from <code>DXGI_ADAPTER_DESC</code>. It is not recommended to use this number. You should preferably call <a class="el" href="#a1ac113daec5f6ef28ecb1786cf544144" title="Retrieves information about current memory usage and budget.">GetBudget()</a> and limit memory usage to <a class="el" href="struct_d3_d12_m_a_1_1_budget.html#a326515f08d89ee2e31dcfdd5c1e8ac71" title="Estimated amount of memory available to the program.">D3D12MA::Budget::BudgetBytes</a> instead.</p>
<ul>
<li>When <a class="el" href="#a9e742884bd45dd7f01193d13fcd05af0" title="Returns true if D3D12_FEATURE_DATA_ARCHITECTURE1::UMA was found to be true.">IsUMA()</a> <code>== FALSE</code> (discrete graphics card):<ul>
<li><code>GetMemoryCapacity(DXGI_MEMORY_SEGMENT_GROUP_LOCAL)</code> returns the size of the video memory.</li>
<li><code>GetMemoryCapacity(DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL)</code> returns the size of the system memory available for D3D12 resources.</li>
</ul>
</li>
<li>When <a class="el" href="#a9e742884bd45dd7f01193d13fcd05af0" title="Returns true if D3D12_FEATURE_DATA_ARCHITECTURE1::UMA was found to be true.">IsUMA()</a> <code>== TRUE</code> (integrated graphics chip):<ul>
<li><code>GetMemoryCapacity(DXGI_MEMORY_SEGMENT_GROUP_LOCAL)</code> returns the size of the shared memory available for all D3D12 resources. All memory is considered "local".</li>
<li><code>GetMemoryCapacity(DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL)</code> is not applicable and returns 0. </li>
</ul>
</li>
</ul>

</div>
</div>
<a id="a08210561b92c4bd7ede9dd7beba4bb80" name="a08210561b92c4bd7ede9dd7beba4bb80"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a08210561b92c4bd7ede9dd7beba4bb80">&#9670;&#160;</a></span>IsCacheCoherentUMA()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">BOOL D3D12MA::Allocator::IsCacheCoherentUMA </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"></span></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns true if <code>D3D12_FEATURE_DATA_ARCHITECTURE1::CacheCoherentUMA</code> was found to be true. </p>
<p>For more information about how to use it, see articles in Microsoft Docs articles:</p>
<ul>
<li>"UMA Optimizations: CPU Accessible Textures and Standard Swizzle"</li>
<li>"D3D12_FEATURE_DATA_ARCHITECTURE structure (d3d12.h)"</li>
<li>"ID3D12Device::GetCustomHeapProperties method (d3d12.h)" </li>
</ul>

</div>
</div>
<a id="a3f3fd1e88cf2cd02257fe272e08a273c" name="a3f3fd1e88cf2cd02257fe272e08a273c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3f3fd1e88cf2cd02257fe272e08a273c">&#9670;&#160;</a></span>IsGPUUploadHeapSupported()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">BOOL D3D12MA::Allocator::IsGPUUploadHeapSupported </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"></span></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns true if GPU Upload Heaps are supported on the current system. </p>
<p>When true, you can use <code>D3D12_HEAP_TYPE_GPU_UPLOAD</code>.</p>
<p>This flag is fetched from <code>D3D12_FEATURE_D3D12_OPTIONS16::GPUUploadHeapSupported</code>.</p>
<p><code>#define D3D12MA_OPTIONS16_SUPPORTED 1</code> is needed for the compilation of this library. Otherwise the flag is always false. </p>

</div>
</div>
<a id="a9e742884bd45dd7f01193d13fcd05af0" name="a9e742884bd45dd7f01193d13fcd05af0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9e742884bd45dd7f01193d13fcd05af0">&#9670;&#160;</a></span>IsUMA()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">BOOL D3D12MA::Allocator::IsUMA </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"></span></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns true if <code>D3D12_FEATURE_DATA_ARCHITECTURE1::UMA</code> was found to be true. </p>
<p>For more information about how to use it, see articles in Microsoft Docs articles:</p>
<ul>
<li>"UMA Optimizations: CPU Accessible Textures and Standard Swizzle"</li>
<li>"D3D12_FEATURE_DATA_ARCHITECTURE structure (d3d12.h)"</li>
<li>"ID3D12Device::GetCustomHeapProperties method (d3d12.h)" </li>
</ul>

</div>
</div>
<a id="a468ba0c93121eaaee402b08775f1dd11" name="a468ba0c93121eaaee402b08775f1dd11"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a468ba0c93121eaaee402b08775f1dd11">&#9670;&#160;</a></span>SetCurrentFrameIndex()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void D3D12MA::Allocator::SetCurrentFrameIndex </td>
          <td>(</td>
          <td class="paramtype">UINT</td>          <td class="paramname"><span class="paramname"><em>frameIndex</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets the index of the current frame. </p>
<p>This function is used to set the frame index in the allocator when a new game frame begins. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>D:/PROJECTS/D3D12 Memory Allocator/REPO/include/<a class="el" href="_d3_d12_mem_alloc_8h.html">D3D12MemAlloc.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
</small></address>
</body>
</html>
